package com.example.rabbitmq7.listener;

import com.example.rabbitmq7.constant.Constants;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class DelayListener {
    @RabbitListener(queues = Constants.DL_QUEUE)
    public void listener(String message, Channel channel) {
        System.out.println("时间:" + new Date() + ",接收到消息:" + message + channel);
    }

    @RabbitListener(queues = Constants.DELAY_QUEUE)
    public void listener2(String message, Channel channel) {
        System.out.println("时间:" + new Date() + ",接收到消息:" + message + channel);
    }
}
